package factory.method.abstractt;

import factory.method.abstractt.factory.Factory;
import factory.method.abstractt.factory.Link;
import factory.method.abstractt.factory.Page;
import factory.method.abstractt.factory.Tray;

public class Main {
    public static void main(String[] args) {

//        dojob("factory.method.abstractt.listfactory.ListFactory");
        dojob("factory.method.abstractt.tablefactory.TableFactory");
    }

    private static void dojob(String classname) {

        Factory factory = Factory.getFactory(classname);
        Link people = factory.createLink("人民日报", "http://www.people.com.cn/");
        Link gmw = factory.createLink("光明日报", "http://www.gmw.cn/");


        Tray tray = factory.createTray("日报");
        tray.addItem(people);
        tray.addItem(gmw);


        Page page = factory.createPage("LinkPage", "哈哈哈");
        page.addItem(tray);
        page.output();

    }
}
